/*
 * @Description 
 * @Autor JoyceGuo
 * @Date 2022-01-18 10:32:27
 * @LastEditors JoyceGuo
 * @LastEditTime 2022-01-18 10:32:28
 */
/*
 * @Description
 * @Author JoyceGuo
 * @Date 2021-12-24 13:58:12
 * @LastEditors JoyceGuo
 * @LastEditTime 2022-01-13 15:01:43
 */
function getCartographicDegreeFromPositon(position) {
  const cartesian = viewer.scene.pickPosition(position)
  const cartographic = Cesium.Cartographic.fromCartesian(cartesian)
  const obj = {
    longitude: Cesium.Math.toDegrees(cartographic.longitude),
    latitude: Cesium.Math.toDegrees(cartographic.latitude),
    height: cartographic.height
  }
  console.log(obj)
  return obj
}

function logFeatureProperties(feature) {
  if (!feature || !feature.getPropertyNames) {
    return
  }
  var propertyNames = feature.getPropertyNames()
  var length = propertyNames.length
  const properties = []
  for (var i = 0; i < length; ++i) {
      var propertyName = propertyNames[i]
      properties.push({ name: propertyName, value: feature.getProperty(propertyName) })
      console.log(propertyName + ': ' + feature.getProperty(propertyName))
  }
  return properties
}
function getFeatureProperties(feature) {
  if (!feature || !feature.getPropertyNames) {
    return
  }
  var propertyNames = feature.getPropertyNames()
  var length = propertyNames.length
  const properties = {}
  for (var i = 0; i < length; ++i) {
      var propertyName = propertyNames[i]
      properties[propertyName] = feature.getProperty(propertyName)
  }
  return properties
}

// cesium 调试log
function cesiumLog(context, msg) {
  if (process.env.NODE_ENV !== 'development') {
    return
  }
  context.$notify({
    title: '',
    message: msg,
    position: 'bottom-right'
  })
}
